<!--：作为父模板，其他模板继承它-->
{% load bootstrap4 %}

<!doctype html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1,
      shrink-to-fit=no">
    <title>Learning Log</title>
    <!-- 使用bootstrap4的自定义模板标签 -->
    {% bootstrap_css %}
    {% bootstrap_javascript jquery='full' %}
  </head>
  <body>

    <!-- 定义导航栏 -->
    <nav class="navbar navbar-expand-md navbar-light bg-light mb-4 border">

      <a class="navbar-brand" href="{% url 'learning_logs:index' %}">
        Learning Log</a>

      <!-- 下拉列表，包含所有导航元素 -->
      <button class="navbar-toggler" type="button" data-toggle="collapse"
          data-target="#navbarCollapse" aria-contrlos="navabarCollapse"
          aria-expanded="false" aria-label="Toggle navigation">
        <span class="navbar-toggler-icon"></span></button>
      <div class="collapse navbar-collapse" id="navbarCollapse">
        <ul class="navbar-nav mr-auto">
          <li class="nav-item">
            <a class="nav-link" href="{% url 'learning_logs:topics' %}">
              Topics</a></li>
        </ul>
        <ul class="navbar-nav ml-auto">
          {% if user.is_authenticated %}
            <li class="nav-item">
              <span class="navbar_texr">Hello!{{ user.username }}.</span>
            </li>
            <li class="nav-item">
              <a class="nav-link" href="{% url 'users:logout' %}">Log out</a>
            </li>
          {% else %}
            <li class="nav-item">
              <a class="nav-link" href="{% url 'users:register' %}">Register</a>
            </li>
            <li class="nav-item">
              <a class="nav-link" href="{% url 'users:login' %}">Log in</a>
            </li>
          {% endif %}
        </ul>
      </div>
      
    </nav>

    <main role="main" class="container">
      <div class="pb-2 mb-2 border-bottom">
        {% block page_header %}{% endblock page_header %}
      </div>
      <div>
        {% block content %}{% endblock content %}
      </div>
    </main>

  </body>

</html>